// 带上版权的高阶函数
function withCopyRight(OldCom) {
  class NewCom extends React.Component {
    render() {
      return (
        <div>
          <OldCom />
          <hr />
          <div>Copyright © 2020 Sohu All Rights Reserved. 搜狐公司 版权所有</div>
        </div>
      );
    }
  }
  return NewCom;
}

//原始组件
class CommentList extends React.Component {
  render() {
    return (
      <div>新闻</div>
    );
  }
}

//调用高阶函数后的组件
const CommentListWithCopyRight = withCopyRight(CommentList);

ReactDOM.render(<div> <CommentListWithCopyRight /></div>, $("box"));
function $(id) {
  return document.getElementById(id);
}
